//引入express模块
const express = require('express');
//引入连接池模块
const pool = require('../pool');
//创建路由器对象
const r = express.Router();


//查询接种记录
r.get("/inoculation",(req,res)=>{
	var sql="select * from inoculation";
	pool.query(sql,(err,result)=>{
		if(err) throw err;
		res.send({ 
			message: 'ok', 
			code: 200, 
			results: result 
		});//表->字符串json
		
	});
});

//查询预约记录
r.get("/appointed",(req,res)=>{
	var sql="select * from appointed";
	pool.query(sql,(err,result)=>{
		if(err) throw err;
		res.send({ 
			message: 'ok', 
			code: 200, 
			results: result //表->字符串json
		});
		
	});
});


//导出路由器对象
module.exports = r;